#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:6031)

#include <iostream>
#include <string>
using namespace std;


int main() {
    string s;
    getline(cin, s);
    size_t pos = s.find(" ");
    int last = 0;
    int len = 0;
    while (pos != string::npos)
    {
        last = pos;
        pos = s.find(" ", pos + 1);
    }

    if (last == 0)
        cout << s.size();
    else
        cout << s.size() - last - 1;
}
